#pragma once
#include "CurveskelPlugins.h"
#include "CurveskelModel.h"
#include "RichParameterSet.h"

class skeleton_compare : public CurveskelFilterPlugin{
    Q_OBJECT
    Q_INTERFACES(FilterPlugin)

private:    
    QMap<QString, CurveskelModel*> skeletons;

public:
    QString name() { return "Skeleton compare"; }
    QString description() { return "Computes difference between skeletons"; }
    
    void initParameters(RichParameterSet* pars){
        /// QMap of skeleton models indexed by name
        skeletons.clear();
        foreach(Model* model, document()->models()){
            CurveskelModel* skel = qobject_cast<CurveskelModel*>(model);
            if(skel) skeletons.insert(model->name, skel);
        }
        if(skeletons.size()<2) 
            throw StarlabException("Comparison requires TWO pre-loaded skeleton models");
        
        pars->addParam( new RichStringSet("Target skeleton", skeletons.keys(), "Target skeleton","The skeleton model to compare *toward*") );
        pars->addParam( new RichBool("Show measurements", false, "Show measurements", "Show blue edge connecting corresponding points") );
    }

    void applyFilter(RichParameterSet*);
};
